import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dk_form/flutter_dk_form.dart';

class TabBarDemoPage extends StatelessWidget {
  static const String routeName = '/page/tab_bar_demo';
  static const String name = "TabBarDemoPage";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("TabBarDemoPage"),
      ),
      body: CustomTabBar(
        getTabBars(),
        myTabBarViews: getTabBarViews(),
        onSelected: (index) {
          print("onSelected index=" + index.toString());
        },
      ),
    );
  }
}

List<Widget> getTabBars() {
  return <Tab>[
    new Tab(
        child: Container(
      child: Text("客户信息"),
      height: 44,
      alignment: Alignment.center,
    )),
    new Tab(
        child: Container(
      child: Text("选定公寓"),
      height: 44,
      alignment: Alignment.center,
    )),
    new Tab(
        child: Container(
      child: Text("客户信息"),
      height: 44,
      alignment: Alignment.center,
    )),
    new Tab(
        child: Container(
      child: Text("选定公寓"),
      height: 44,
      alignment: Alignment.center,
    )),
  ];
}

List<Widget> getTabBarViews() {
  List<Widget> tabBarViews = List();
  tabBarViews.add(Center(child: new Text("客户信息")));
  tabBarViews.add(Center(child: new Text("选定公寓")));
  tabBarViews.add(Center(child: new Text("客户信息")));
  tabBarViews.add(Center(child: new Text("选定公寓")));
  return tabBarViews;
}